package com.yuanfeng.action.front.user.service;

import com.yuanfeng.action.front.user.dao.IUserDao;
import com.yuanfeng.action.front.user.dao.UserDaoImpl;
import com.yuanfeng.pojo.Users;

import java.util.List;

public class UserServiceImpl implements IUserService {


	private IUserDao userDaoImpl;

	public void setUserDaoImpl(IUserDao userDaoImpl) {
		this.userDaoImpl = userDaoImpl;
	}

	/**
	 * 用户登录模块
	 * @param name
	 * @return
	 */
	public List<Users> login(String name) {
		String hql = "from Users where name=?";
		return userDaoImpl.findByName(hql,name);
	}

	/**
	 * 用户注册模块
	 * @param user
	 */
	public void reg(Users user) {
		 userDaoImpl.save(user);
	}

	/**
	 * 根据code查询用户的存入的validatecode是否匹配
	 * @param code
	 * @return
	 */
	public Users queryUser(String code){
		return userDaoImpl.queryUser(code);
	}

}
